package com.tuyrt.firstcode.utils

/**
 * Created by tuyrt7 on 2021/4/12.
 */

fun <T : Comparable<T>> max(vararg nums: T): T {
    if (nums.isEmpty()) throw IllegalArgumentException("num is null")
    var maxNum = nums[0]
    for (num in nums) {
        if (num > maxNum) {
            maxNum = num
        }
    }
    return maxNum
}